#include <iostream>

using namespace std;

int x1[1005], y1[1005];
int x2[1005], y2[1004];

int cnt, last;

int main()
{
    int n, m;
    int x, y;
    int a, b;
    
    cin >> n >> m >> x >> y;
    
    for(int i = 0; i < x; i++) {
        cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];
    }
    
    for(int i = 0; i < y; i++) {
        cin >> a >> b;
        cnt = 0;
        for(int j = 0; j < x; j++) {
           if(a >= x1[j] && a <= x2[j] && b >= y1[j] && b <= y2[j]) {
               cnt++;
               last = j;   // 记录轰炸的次数
           } 
        }
        
        if(!cnt) {
            cout << "N" << endl;
        } else {
            cout << "Y " << cnt << " " << ++last << endl;
        }
    }
    
    return 0;
}